public class Rule {
    public int a;
    public int b;
    public Rule(int a, int b) {
        this.a = a;
        this.b = b;
    }
    @Override
    public boolean equals(Object other) {
        if (other instanceof Rule) {
            Rule otherRule = (Rule) other;
            return a == otherRule.a && b == otherRule.b;
        }
        return false;
    }
    @Override
    public int hashCode() {
        String s = "" + a + " " + b;
        return s.hashCode();
    }
}